package com.jnxg.smartcommunity.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.jnxg.smartcommunity.R;
import com.jnxg.smartcommunity.activity.user.LoginActivity;
import com.jnxg.smartcommunity.contas.Contas;

//启动页面
public class LauncherActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_launcher);
        ImageView iv = (ImageView) findViewById(R.id.iv);
        Glide.with(this).load("http://pic.qiantucdn.com/58pic/17/23/82/53F58PICbPB_1024.jpg!/format/webp").into(iv);
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                String token = Contas.getToken(LauncherActivity.this);
                if(token.isEmpty()){
                    Intent intent = new Intent(LauncherActivity.this, LoginActivity.class);
                    startActivity(intent);
                    finish();
                }else{
                    Intent intent = new Intent(LauncherActivity.this, MainActivity.class);
                    startActivity(intent);
                    finish();
                }

            }
        }, 3000);
    }

}
